package com.karst.essentials.chapter04
{
	import flash.events.Event;
	
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.objects.primitives.Cone;
	import org.papervision3d.view.BasicView;
	
	internal class ColorMaterialExample extends BasicView
	{
		public function ColorMaterialExample()
		{
			super() ;
			createView() ;
			startRendering() ;
		}
		
		private var material : ColorMaterial = null ;
		private var cone : Cone = null ;
		private function createView() : void
		{
			if( material == null )
				material = new ColorMaterial( 0xFF0000, 1, true ) ;
			if( cone == null )
				cone = new Cone( material, 200, 400, 12, 10 ) ;
			
			scene.addChild( cone ) ;
		}
		
		override protected function onRenderTick(event:Event=null):void
		{
			super.onRenderTick( event ) ;
			if( cone )
				cone.localRotationY++ ;
		}
	}
}